﻿using EPiServer.Core;

namespace OpenWaves.EPiServer
{
    public static class PropertyDataExtensions
    {
         public static PageReference GetParentLink(this PropertyData propertyData)
         {
             if (propertyData.Parent == null)
                 return PageReference.EmptyReference;

             var propertyPageReference = propertyData.Parent[BuiltInProperties.PageLink] as PropertyPageReference;
             if (propertyPageReference == null)
                 return PageReference.EmptyReference;

             return propertyPageReference.PageLink;
         }
    }
}